import 'package:flutter_ok/util/string_util.dart';
import 'package:flutter_ok/util/util.dart';

class AccountManager {
  factory AccountManager() => _getInstance();

  static AccountManager get instance => _getInstance();
  static AccountManager _instance;

  AccountManager._internal() {
    // 初始化
  }

  static AccountManager _getInstance() {
    if (_instance == null) {
      _instance = AccountManager._internal();
    }
    return _instance;
  }

  /// 是否登录
  bool isLogin() {
    return StringUtil.isNotEmpty(getUid());
  }

  String getUid() {
    return SpUtil.getString("uid") ?? "";
  }

  String getToken() {
    return SpUtil.getString("token") ?? "";
  }
}
